package Text2;

import java.util.*;

/*
 *@Student 张策
 */
public class Main {
    public static void main(String[] args) {
        HashMap<String, Integer> map = new HashMap<>();
        map.put("1号",10);
        map.put("2号",20);
        map.put("3号",30);
        Set<Map.Entry<String, Integer>> entries = map.entrySet();
        Iterator<Map.Entry<String, Integer>> iterator = entries.iterator();
        while (iterator.hasNext()) {
            Map.Entry<String, Integer> next = iterator.next();
            System.out.println(next.getKey()+"-"+next.getValue());
        }
//        Set<String> name = map.keySet();
//        Iterator<String> iterator = name.iterator();
//        while (iterator.hasNext()) {
//            String next = iterator.next();
//            System.out.println(next+"-"+map.get(next));
//        }
//        Student student1 = new Student("1号", 10);
//        Student student2 = new Student("2号", 20);
//        Student student3 = new Student("3号", 30);
//        HashSet<Student> set = new HashSet<>();
//        set.add(student1);
//        set.add(student2);
//        set.add(student3);
//        Iterator<Student> iterator = set.iterator();
//        while (iterator.hasNext()) {
//            Student next = iterator.next();
//            System.out.println(next);
//        }
    }
}
